<?php

/**
* alltosun.com 短信平台控制器 index.php
* ============================================================================
* 版权所有 (C) 2009-2014 北京互动阳光科技有限公司，并保留所有权利。
* 网站地址: http://www.alltosun.com
* ----------------------------------------------------------------------------
* 许可声明: 这是一个开源程序，未经许可不得将本软件的整体或任何部分用于商业用途及再发布。
* ============================================================================
* $Author: 吴松键 (wusj@alltosun.com) $
* $Date: 2014-9-23 上午10:59:56 $
* $Id$
*/

class Action
{

    private $ua; //帐号
    private $pw; //密码

    public function __construct()
    {
        $this->ua = sms_config::$sms_ua;
        $this->pw = sms_config::$sms_pw;
    }

    public function __call($action = '', $param = array())
    {

    }



    public function send_sms()
    {
        $return_info = sms_helper::send_sms('18501378715', 'register', '33321是您的验证码，十分钟内有效。感谢您对【联想NBD】的支持，如需帮助请联系客服电话：400-875-2580【联想NBD】');
        var_dump($return_info);

        // $mobile = '15010951593';
        // $content = '您好';
        // $ua = $this->ua;
        // $time = date('mdHi',time());
        // $pw = MD5($this->pw.'/'.$time);
        // $send_url = "http://59.151.6.148:8001/qxt/x.jsp?ua=".$ua."&pw=".$pw."&mb=".$mobile."&ms=".$content."&t=".$time;
        // // $send_url = urlencode($send_url);
        // $return_info = curl_request($send_url, 'get');
        // var_dump($return_info);
    }

    //返回报告
    public function rpturl()
    {
        $tid = Request::Get('id', '');
        $rpmsg = Request::Get('st', '');
        $phone = Request::Get('mb', '');
        $sms_info = array();
        if($rpmsg == 'DELIVRD') {
            $sms_info['status'] = 10;
        } else {
            $sms_info['status'] = 1;
        }
        $sms_info['report_info'] = $rpmsg;
        _model('sms_status')->update(array('sms_id' => $tid, 'mobile' => $phone), $sms_info);
        echo 0;
    }

    //查询余额
    public function sms_balance()
    {
        $return_info = sms_helper::sms_balance();
        var_dump($return_info);
    }


}
?>